package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.annotation.AutoFill;
import com.sky.dto.SetmealPageQueryDTO;
import com.sky.entity.Setmeal;
import com.sky.enumeration.OperationType;
import com.sky.vo.SetmealVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Collection;
import java.util.List;

@Mapper
public interface SetmealMapper {

    @Select("select count(*) from setmeal where category_id=#{categoryId}")
    Integer countByCategoryId(Long categoryId);


    List<Setmeal> selectAboutSetmealByDishIds(List<Long> ids);

    @Select("select * from setmeal where id=#{id}")
    List<Setmeal> selectAboutSetmealByDishId(Long id);

    List<Setmeal> selectConditionBy(Long categoryId, Integer enable);

    Page<SetmealVO> selectSetmealListBySetmealPageQueryDTO(SetmealPageQueryDTO setmealPageQueryDTO);

    @AutoFill(OperationType.INSERT)
    void insert(Setmeal setmeal);

    @Select("select * from setmeal where id=#{id}")
    Setmeal selectById(Long id);


    @AutoFill(OperationType.UPDATE)
    void update(Setmeal setmeal);

    void deleteBatch(List<Long> ids);
}
